

**Zhou, Rong, Bi,Xiang, and Segerson, Kathleen. 2019. Evaluating Voluntary Environmental Programs with Spillover Effects*
 
capture clear
set more off

use addSpilloverVariable_modified2.dta, clear

xtset facilityid year, yearly

gen incomepercapita = percapita/1000  
gen lagratio_industry	= l.ratio_industry
gen lagcompanypart = l.companygeneralspillover	
gen lagcompanyinduspart=l.companywithinindustryspillover	
gen lagratio_industry1995 = l.ratio_industry1995	
gen lagcompanypart1995  = l.companygeneralspillover1995	
gen lagcompanyinduspart1995=l.companywithinindustryspillover19


*variable names

lab var part_modified "facility participation"
lab var mail1  "first invitation group"
lab var trishare2 "facility's share of releases in firm's total tri"
lab var pred "firm's prior reduction in releases"

lab var rate_hap "hap/tri ratio"
lab var non_attain "county's non-attainment status"
lab var afs_inspect "facility's inspection by clean air regulation"
lab var afs_penalty "facility's penalty by clean air regulation"

lab var lcvscore "state lcv score"
lab var lcvscore_square "state lcv score squared"

lab var incomepercapita "county percapita income squared"

lab var facilityid "TRIFID"
lab var company "Generated Unique Company Index"
lab var plantnr "Number of trif facilities of the company"
lab var all_tri "tri releases by facility"
lab var companytri "total tri releases by company"
lab var company33 "total 33/50 releases by company"
lab var mprgtox_1 "toxicity-weighted 33/50 releases by facility weight 1"
lab var mprgtox_2 "toxicity-weighted 33/50 releases by facility weight 2"
lab var mprgtox_3 "toxicity-weighted 33/50 releases by facility weight 3"
lab var prg "33/50 releases by facility"

lab var pp33_50  "Dummy=1 if parent company is a participant"
lab var fp33_50 "Dummy=1 if facility is a participant"
lab var part "dummy=1 when and after facilitiy joined the program"
lab var year_parent "year when parent company joined the program"
lab var fips "County fips codes"

lab var m1 "log of 33/50 releases"
lab var g1re1 "log of ozone delepeting releases (landecon)"
lab var  nozre1 "log of nonozone depeleting 33/50 chemicals"

lab var offsite "33/50 chemicals recycled offsite"
lab var onsite "33/50 chemicals recycled onsite"

lab var industry "2digit sic code"

*other variables
lab var club "sierra club membership in 10,000 dollars"
lab var medincome "county median income"
lab var finalgood "dummy=1 if facility produced finalgood to consumers"

*Note: indi1-indi10 are industry dummies

*1. Without spillover (Table 2 column 1) 
*Stata code:
probit part_modified mail1 trishare2 pred l.rate_hap l.afs_inspect  indi1- indi10 non_attain lcvscore lcvscore_square incomepercapita i.year if year>=1991 & year<=1995 & part_modified<2 , vce(cluster facilityid)

*2. With spillover (Table 2 column 2)
*Stata code:
probit part_modified mail1 trishare2 pred l.rate_hap l.afs_inspect  indi1- indi10 non_attain lcvscore lcvscore_square incomepercapita i.year l.(ratio_industry) if year>=1991 & year<=1995 & part_modified<2 , vce(cluster facilityid)

predict estiprob, pr

gen estiprob_modify1=estiprob

replace estiprob_modify1=0 if year<1991     /*assign 0 to estimated participation prob. before the program started*/

/*In addition, use matlab "ReviseEstimateProbab3.mat", adding two variables:
1) estiprob_modify: revise the estiprob, make the later years' estiprob the same as its first joined year; for nonparticipants or participants before joined, use the stata estiprob, (once joined the estiprob not change)
2) estiprob_modify2: 1996~2001 use 1995

use matlab "deriveaddYearSpecificSpillover4" to generate datafile "addYearSpecificSpillover" which defines spillover variables
*/

use addYearSpecificSpillover4.dta, clear

*Stata code:
forvalues yr=1991/2001{
forvalues lag=2  / 4 {
quietly gen z1`yr'L`lag'=L`lag'.m1 if year==`yr'
}
}

quietly recode z1* (.=0)           /*assign 0 to missing value */

/* stack L2.m1:  (lag 2 period)*/

local iv1="z11991L2 z11992L2 z11993L2 z11994L2 z11995L2 z11996L2 z11997L2 z11998L2 z11999L2 z12000L2 z12001L2"

gen t1991 = 0
gen t1992 = 0
gen t1993 = 0
gen t1994 = 0
gen t1995 = 0
gen t1996 = 0
gen t1997 = 0
gen t1998 = 0
gen t1999 = 0
gen t2000 = 0
gen t2001 = 0
replace t1991 =1 if year==1991
replace t1992 =1 if year==1992
replace t1993 =1 if year==1993
replace t1994 =1 if year==1994
replace t1995 =1 if year==1995
replace t1996 =1 if year==1996
replace t1997 =1 if year==1997
replace t1998 =1 if year==1998
replace t1999 =1 if year==1999
replace t2000 =1 if year==2000
replace t2001 =1 if year==2001


gen inditrend1 =  indi1*(year-1990)
gen inditrend2 =  indi2*(year-1990)
gen inditrend3 =  indi3*(year-1990)
gen inditrend4 =  indi4*(year-1990)
gen inditrend5 =  indi5*(year-1990)
gen inditrend6 =  indi6*(year-1990)
gen inditrend7 =  indi7*(year-1990)
gen inditrend8 =  indi8*(year-1990)
gen inditrend9 =  indi9*(year-1990)
gen inditrend10 =  indi10*(year-1990)

** Without spillover
*Stata code:
*Table 3 column 1

xtset facilityid year, yearly
local iv1 = "z11991L3 z11992L3 z11993L3 z11994L3 z11995L3 z11996L3"
xi: ivreg2 d.m1 (d.(L1.m1) part2 = `iv1' estipart2) ld.rate_hap ld.afs_inspect d.(lcvscore  lcvscore_square non_attain incomepercapita) ///
d.(t1991 t1992 t1993 t1994 t1995 t1996 t1997 t1998 t1999 t2000 t2001) ///
d.(indi1 indi2 indi3 indi4 indi5 indi6 indi7 indi8 indi9 indi10 inditrend1 inditrend2 inditrend3 inditrend4 inditrend5 inditrend6 inditrend7 inditrend8 inditrend9 inditrend10) ///
i.state, nocons cluster(facilityid)  gmm2s robust small, if year>=1991 & year<=1996


*2. With spillover
*Stata code:
*Table 3 column 2

xtset facilityid year, yearly
local iv1 = "z11991L3 z11992L3 z11993L3 z11994L3 z11995L3 z11996L3"
xi: ivreg2 d.m1 (d.(L1.m1) part2 intrafirmspillover2 interspillover1991 interspillover1992 interspillover1993 interspillover1994 interspillover1995 interspillover1996 = `iv1' estipart2 estiintrafirmspillover2 estinterspillover1991 estinterspillover1992 estinterspillover1993 estinterspillover1994 estinterspillover1995 estinterspillover1996) ///
ld.rate_hap ld.afs_inspect ///
d.(lcvscore  lcvscore_square non_attain incomepercapita) ///
d.(t1991 t1992 t1993 t1994 t1995 t1996 t1997 t1998 t1999 t2000 t2001) d.(indi1 indi2 indi3 indi4 indi5 indi6 indi7 indi8 indi9 indi10 inditrend1 inditrend2 inditrend3 inditrend4 inditrend5 inditrend6 inditrend7 inditrend8 inditrend9 inditrend10) /// 
i.state, nocons cluster(facilityid)  gmm2s robust small, if year>=1991 & year<=1996


*Step 3: Impact analysis (Table 4)
* Use matlab codes: deriveProgramEffect5 and deriveReductionPercentage6_2



